#define _CRT_SECURE_NO_WARNINGS 1
#include "reverse_iterator.h"
#include "vector.h"
#include <vector>
#include <string>
void test1() {
	vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);
	for (auto ch : v) {
		cout << ch << ' ';
	}
	cout << endl;

	v.resize(10,768);
	for (auto ch : v) {
		cout << ch << ' ';
	}
	cout << endl;
}

void test2() {
	std::vector<int> sv;
	sv.push_back(1);
	std::vector<int>::iterator sit = sv.insert(sv.begin(), 100);
	*sit = 89;
	for (auto ch : sv) {
		cout << ch << ' ';
	}
	cout << endl;


	vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);
	vector<int>::iterator it = v.insert(v.begin(), 100);
	*it = 89;
	for (auto ch : v) {
		cout << ch << ' ';
	}
	cout << endl;

	vector<int>::iterator tit = v.erase(v.begin());
	*tit = 89;
	for (auto ch : v) {
		cout << ch << ' ';
	}
	cout << endl;
}

void test3() {
	/*std::vector<string> sv;
	sv.push_back(1);
	std::vector<int>::iterator sit = sv.insert(sv.begin(), 100);
	*sit = 89;
	for (auto ch : sv) {
		cout << ch << ' ';
	}
	cout << endl;*/

	vector<std::string> v;
	v.push_back("a");
	v.push_back("b");
	v.push_back("c");
	v.push_back("d");
	v.push_back("e");
	v.push_back("g");
	vector<std::string>::iterator it = v.insert(v.begin(), "xxx");
	*it = 89;
	for (auto ch : v) {
		cout << ch << ' ';
	}
	cout << endl;
	cout << v[-1] << endl;

	vector<std::string> tv;
	tv.push_back("a");
	vector<std::string>::iterator tit = v.erase(v.begin());
	*tit = 89;
	v.swap(tv);
	for (auto ch : v) {
		cout << ch << ' ';
	}
	cout << endl;

	for (auto ch : tv) {
		cout << ch << ' ';
	}
	cout << endl;
}

void test4() {
	vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);
	vector<int>::riterator it = v.rbegin();
	while (it != v.rend()) {
		cout << *it << ' ';
		++it;
	}
	cout << endl;
	const vector<int> tmp = v;
	vector<int>::const_riterator itt = tmp.rbegin();
	while (itt != tmp.rend()) {
		cout << *itt << ' ';
		++itt;
	}
	cout << endl;
}

int main() {
	test4();
}